#include "HighScoreData.h"


HighScoreData::HighScoreData(void)
{
	// playerName is NULL by default
	this->playerScore = 0;
}

HighScoreData::HighScoreData( std::string name, int score )
{
	this->playerName = name;
	this->playerScore = score;
}

HighScoreData::~HighScoreData(void)
{
}

ostream& operator<<( ostream &out, HighScoreData &hop )
{
	out << "[";
	out << hop.playerName << ",";
	out << hop.playerScore << "]";

	return out;
}

istream& operator>>( istream &in, HighScoreData &hop )
{
	char c;

	in >> c; // Drop bracket
	getline( in, hop.playerName, ',' );
	in >> skipws >> hop.playerScore >> skipws >> c;

	return in;
}

bool operator==( HighScoreData &vop, HighScoreData &hop )
{
	if( vop.playerName == hop.playerName )
	{
		if( vop.playerScore == hop.playerScore )
		{
			return true;
		}
	}
	return false;
}

bool operator!=( HighScoreData &vop, HighScoreData &hop )
{
	return !(vop == hop);
}

bool operator<( HighScoreData &vop, HighScoreData &hop )
{
	if( vop.playerScore < hop.playerScore )
		return false;

	return true;
}